#

| Chapter 2 Logging In |

## 2.11 Faster ksh and bash Startup with $- Test

Do you use the Korn shell - and does your account have an "ENV file" (2.2) (a startup file named in the ENV environment variable)? bash users, you probably have setup files like .bashrc or .bash_login. You might have the same problem (2.9) that C shell users have with .cshrc: noninteractive shells read aliases and other lines that you want to be read only by interactive shells. Speed up your file by adding a test like this:

    case
    case $- in
      *i*);;
      *) return 0;;
    esac
    # COMMANDS BELOW THIS LINE WILL ONLY BE RUN BY INTERACTIVE SHELLS:
       ...

The test checks to see if the shell's -i option is set. If it isn't, the `return` `0` quits the file.

- JP

2.10 Gotchas in set prompt Test |  | 2.12 Automatic Setups for Different Terminals